package com.websocket.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.security.auth.UserPrincipal;
import com.websocket.event.EventListenerRegistry;
import com.websocket.hander.InterceptorRegistry;
import com.websocket.handshake.HandshakeRegistry;
import org.java_websocket.handshake.ClientHandshake;

import java.security.Principal;
import java.util.UUID;

public interface DefaultWebSocketConfigurer {
    default void registerHandshake(HandshakeRegistry registry) {
    }

    default void registryHandler(InterceptorRegistry registry) {
    }

    default void registryEventListener(EventListenerRegistry registry) {
    }

    default ObjectMapper setMessageConverter() {
        return new ObjectMapper();
    }

    default Principal determineUser(ClientHandshake handshake) {
        return new UserPrincipal(UUID.randomUUID().toString());
    }

}